package com.svse.designPattern.behaviour.visitor.structure;

import com.svse.designPattern.behaviour.visitor.service.Element;
import com.svse.designPattern.behaviour.visitor.service.Visitor;

import java.util.ArrayList;
import java.util.List;

/**
 * @author LiYuhang
 * @version 0.1
 * @application
 * @Date 2020/8/9 9:54
 */
public class ObjectStructure {
    private List<Element> elementList=new ArrayList<Element>(10);

    public void accept(Visitor visitor){
        elementList.forEach(element ->element.accept(visitor) );
    }

    public void add(Element element){
        elementList.add(element);
    }

    public void remove(Element element){
        elementList.remove(element);
    }
}
